package model

// UserInfo defines the structure that the user info service interface is returning
type UserInfo struct {
	Subject			string		`json:"sub"`

	Name 			string		`json:"name,omitempty"`
	GivenName 		string		`json:"given_name,omitempty"`
	FamilyName 		string		`json:"family_name,omitempty"`
	Email 			string		`json:"email,omitempty"`
	EmailVerified 	bool		`json:"email_verified,omitempty"`
	PhoneNumber 	string		`json:"phone,omitempty"`

	//Groups			[]Group		`json:"groups,omitempty"`
	Groups			[]string	`json:"groups"`
}


// User defines the struct that is used in order to actually map user info service request to/from the gorm backend
type User struct {
	ID				uint		`json:"-"`
	Subjects		[]Subject	`json:"subjects";gorm:"primary_key"`

	Name 			string		`json:"name"`
	GivenName 		string		`json:"given_name"`
	FamilyName 		string		`json:"family_name"`
	Email 			string		`json:"email"`
	EmailVerified 	bool		`json:"email_verified"`
	PhoneNumber 	string		`json:"phone"`

	Groups			[]Group		`json:"groups"`
}


type Subject struct {
	ID	uint			`json:"-" gorm:"primary_key,index";`
	UserID 		uint	`json:"-";`
	Subject 	string 	`json:"subject"`
}

type Group struct {
	ID			uint	`json:"-";gorm:"primary_key,index";`
	UserID		uint	`json:"-"`
	Group 		string 	`json:"group"`
}